package com.zhangzhibo.utils;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {
    public static String shortDateFormat = "yyyy-MM-dd";
    public static String timeDateFormat = "yyyy/MM/dd";
    static DateFormat dateFormat;

    public static String DateToString(Date date,String format){
        dateFormat = new SimpleDateFormat(format);
        return dateFormat.format(date);
    }

    public static Date StringToDate(String dateStr,String format) throws ParseException {
        dateFormat = new SimpleDateFormat(format);
        Date parse = dateFormat.parse(dateStr);
        return parse;
    }

}
